package com.wanchuang.hepos.ui.page.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.wanchuang.hepos.R;
import com.wanchuang.hepos.proto.MemberCoupon;
import com.wanchuang.hepos.proto.MemberOuterClass;

import java.util.List;

/**
 * 文件名 : ZhanDanAdapter
 * 创建者 : MangoWang
 * 创建日期 : 2019/12/26 15:44
 * 微信 : MangoWaWang
 * 邮箱 : 763482205@qq.com
 * 描述 : TODO
 */
public class CouponAdapter extends BaseQuickAdapter<MemberCoupon.CouponInfo, BaseViewHolder> implements LoadMoreModule {
    public CouponAdapter(List<MemberCoupon.CouponInfo> data) {
        super(R.layout.item_coupon, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MemberCoupon.CouponInfo item) {
        helper.setText(R.id.tv_number, "券号："+item.getId());

        switch (item.getState())
        {
            case "1":
                helper.setText(R.id.tv_time,"有效期至："+item.getEndDate());
                break;
            case "2":
                helper.setText(R.id.tv_time,"于"+item.getEndDate() + " 已使用");
                break;
            case "3":
                helper.setText(R.id.tv_time,"于"+item.getEndDate() + " 已过期");
                break;
        }
    }


}
